import React from "react";
import frame from '../../../style/frame.less';

import Dialog from './Dialog';
import connect from "react-redux/es/connect/connect";
import * as Actoin from "../../services/action";

class DialogLayout extends React.Component {

    constructor(props) {
        super(props);
    }

    loadModuleMenu = () => {
        this.props.loadModuleMenu('dialogState', '')
    };

    render() {
        const {children, id} = this.props;

        return (
            <div className={`${frame.dialogLayout} ${this.props.dialogState == id ? frame.enabled : frame.disabled}`}>
                <div className={frame.dialogModel} onClick={this.loadModuleMenu}></div>
                {children}
            </div>
        )
    }
}


const mapStateToProps = (store) => {
    return {
        dialogState: store.dialogState,
    }
};

export default connect(mapStateToProps, Actoin)(DialogLayout)
